package cn.shenning.algorithm.array;
public class QuickSort {
    public static void quickSort(int a[], int start, int end) {
        if (start >= 0 && end <= a.length - 1 && start < end) {
            int low = start;
            int high = end;
            int splitKey = a[start];
            while (start < end) {
                while (start < end && a[end] >= splitKey) end--;
                a[start] = a[end];
                while (start < end && a[start] <= splitKey) start++;
                a[end] = a[start];
            }
            a[end] = splitKey;
            quickSort(a, low, start - 1);
            quickSort(a, start + 1, high);
        }
    }

    public static void quickSort(int a[]) {
        quickSort(a, 0, a.length - 1);
    }
}
